{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 公众号：数据不吹牛\n",
    "### 更多案例和有趣分析等你来撩"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "os.chdir('C:\\\\Users\\\\Administrator\\\\教程\\\\知乎清洗')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 打开第一个问题的回答"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_excel('过年工作问题.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>token</th>\n",
       "      <th>内容</th>\n",
       "      <th>创建时间</th>\n",
       "      <th>性别</th>\n",
       "      <th>是否可以评论</th>\n",
       "      <th>更新时间</th>\n",
       "      <th>点赞数</th>\n",
       "      <th>用户ID</th>\n",
       "      <th>用户名</th>\n",
       "      <th>用户类型</th>\n",
       "      <th>签名</th>\n",
       "      <th>被关注人数</th>\n",
       "      <th>评论数</th>\n",
       "      <th>问题</th>\n",
       "      <th>专业</th>\n",
       "      <th>教育经历</th>\n",
       "      <th>行业</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>sun-wu-jing-91-57</td>\n",
       "      <td>不该。&lt;br/&gt;千万别说。&lt;br/&gt;&lt;br/&gt;以我为例，&lt;br/&gt;&lt;br/&gt;我实在是没法跟亲...</td>\n",
       "      <td>1518103736</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>1518103812</td>\n",
       "      <td>1342</td>\n",
       "      <td>ce8245b32b745f18ef58ca042a3a8651</td>\n",
       "      <td>孙悟净</td>\n",
       "      <td>people</td>\n",
       "      <td>她说要把它们都打败\\n我说我会一直都在</td>\n",
       "      <td>37173</td>\n",
       "      <td>200</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>第二小学</td>\n",
       "      <td>['黑色金属', '一无所有', '背负着空虚倔强']</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>wo-ai-luo-4-14</td>\n",
       "      <td>&lt;figure&gt;&lt;noscript&gt;&lt;img src=\"https://pic2.zhimg...</td>\n",
       "      <td>1518092713</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>1518092913</td>\n",
       "      <td>513</td>\n",
       "      <td>bef6149719717434b53d897031c5da20</td>\n",
       "      <td>林杰</td>\n",
       "      <td>people</td>\n",
       "      <td>鸡飞的男人</td>\n",
       "      <td>8</td>\n",
       "      <td>65</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>['创意艺术']</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               token                                                 内容  \\\n",
       "0  sun-wu-jing-91-57  不该。<br/>千万别说。<br/><br/>以我为例，<br/><br/>我实在是没法跟亲...   \n",
       "1     wo-ai-luo-4-14  <figure><noscript><img src=\"https://pic2.zhimg...   \n",
       "\n",
       "         创建时间  性别  是否可以评论        更新时间   点赞数                              用户ID  \\\n",
       "0  1518103736   1    True  1518103812  1342  ce8245b32b745f18ef58ca042a3a8651   \n",
       "1  1518092713   1    True  1518092913   513  bef6149719717434b53d897031c5da20   \n",
       "\n",
       "   用户名    用户类型                   签名  被关注人数  评论数                      问题   专业  \\\n",
       "0  孙悟净  people  她说要把它们都打败\\n我说我会一直都在  37173  200  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "1   林杰  people                鸡飞的男人      8   65  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "\n",
       "   教育经历                           行业  \n",
       "0  第二小学  ['黑色金属', '一无所有', '背负着空虚倔强']  \n",
       "1   NaN                     ['创意艺术']  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 把代表性别的0，1，-1替换成女，男，未知"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "df['sex'] = np.where(df['性别'] == 1,'男',\n",
    "                    np.where(df['性别'] == 0,'女','未知'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>token</th>\n",
       "      <th>内容</th>\n",
       "      <th>创建时间</th>\n",
       "      <th>性别</th>\n",
       "      <th>是否可以评论</th>\n",
       "      <th>更新时间</th>\n",
       "      <th>点赞数</th>\n",
       "      <th>用户ID</th>\n",
       "      <th>用户名</th>\n",
       "      <th>用户类型</th>\n",
       "      <th>签名</th>\n",
       "      <th>被关注人数</th>\n",
       "      <th>评论数</th>\n",
       "      <th>问题</th>\n",
       "      <th>专业</th>\n",
       "      <th>教育经历</th>\n",
       "      <th>行业</th>\n",
       "      <th>sex</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>sun-wu-jing-91-57</td>\n",
       "      <td>不该。&lt;br/&gt;千万别说。&lt;br/&gt;&lt;br/&gt;以我为例，&lt;br/&gt;&lt;br/&gt;我实在是没法跟亲...</td>\n",
       "      <td>1518103736</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>1518103812</td>\n",
       "      <td>1342</td>\n",
       "      <td>ce8245b32b745f18ef58ca042a3a8651</td>\n",
       "      <td>孙悟净</td>\n",
       "      <td>people</td>\n",
       "      <td>她说要把它们都打败\\n我说我会一直都在</td>\n",
       "      <td>37173</td>\n",
       "      <td>200</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>第二小学</td>\n",
       "      <td>['黑色金属', '一无所有', '背负着空虚倔强']</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>wo-ai-luo-4-14</td>\n",
       "      <td>&lt;figure&gt;&lt;noscript&gt;&lt;img src=\"https://pic2.zhimg...</td>\n",
       "      <td>1518092713</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>1518092913</td>\n",
       "      <td>513</td>\n",
       "      <td>bef6149719717434b53d897031c5da20</td>\n",
       "      <td>林杰</td>\n",
       "      <td>people</td>\n",
       "      <td>鸡飞的男人</td>\n",
       "      <td>8</td>\n",
       "      <td>65</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>['创意艺术']</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               token                                                 内容  \\\n",
       "0  sun-wu-jing-91-57  不该。<br/>千万别说。<br/><br/>以我为例，<br/><br/>我实在是没法跟亲...   \n",
       "1     wo-ai-luo-4-14  <figure><noscript><img src=\"https://pic2.zhimg...   \n",
       "\n",
       "         创建时间  性别  是否可以评论        更新时间   点赞数                              用户ID  \\\n",
       "0  1518103736   1    True  1518103812  1342  ce8245b32b745f18ef58ca042a3a8651   \n",
       "1  1518092713   1    True  1518092913   513  bef6149719717434b53d897031c5da20   \n",
       "\n",
       "   用户名    用户类型                   签名  被关注人数  评论数                      问题   专业  \\\n",
       "0  孙悟净  people  她说要把它们都打败\\n我说我会一直都在  37173  200  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "1   林杰  people                鸡飞的男人      8   65  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "\n",
       "   教育经历                           行业 sex  \n",
       "0  第二小学  ['黑色金属', '一无所有', '背负着空虚倔强']   男  \n",
       "1   NaN                     ['创意艺术']   男  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 绘制匿名用户占比和剔除掉性别的占比图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"c80b2d639a374428b78650558a98dd0a\" style=\"width:1000px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_c80b2d639a374428b78650558a98dd0a = echarts.init(document.getElementById('c80b2d639a374428b78650558a98dd0a'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_c80b2d639a374428b78650558a98dd0a = {\n",
       "    \"color\": [\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#2a5caa\",\n",
       "        \"#b2d235\",\n",
       "        \"#2f4554\",\n",
       "        \"#ac6767\",\n",
       "        \"#6d8346\",\n",
       "        \"#1d953f\",\n",
       "        \"#f47920\",\n",
       "        \"#f6f5ec\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#749f83\",\n",
       "        \"#905a3d\",\n",
       "        \"#f05b72\",\n",
       "        \"#726930\",\n",
       "        \"#6950a1\",\n",
       "        \"#fab27b\",\n",
       "        \"#546570\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#ca8622\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#444693\",\n",
       "        \"#918597\",\n",
       "        \"#c23531\"\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"radius\": [\n",
       "                \"30%\",\n",
       "                \"60%\"\n",
       "            ],\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"value\": 0.08316831683168317,\n",
       "                    \"name\": \"\\u533f\\u540d\\u7528\\u6237\"\n",
       "                },\n",
       "                {\n",
       "                    \"value\": 0.9168316831683169,\n",
       "                    \"name\": \"\\u6b63\\u5e38\\u7528\\u6237\"\n",
       "                }\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"30%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"type\": \"pie\",\n",
       "            \"seriesId\": 2161846,\n",
       "            \"name\": \"A\",\n",
       "            \"roseType\": \"radius\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": \"{b}: {d}%\",\n",
       "                    \"position\": \"outside\",\n",
       "                    \"show\": true\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": \"{b}: {d}%\",\n",
       "                    \"show\": true\n",
       "                }\n",
       "            }\n",
       "        },\n",
       "        {\n",
       "            \"radius\": [\n",
       "                \"30%\",\n",
       "                \"60%\"\n",
       "            ],\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"value\": 168,\n",
       "                    \"name\": \"\\u7537\"\n",
       "                },\n",
       "                {\n",
       "                    \"value\": 109,\n",
       "                    \"name\": \"\\u5973\"\n",
       "                },\n",
       "                {\n",
       "                    \"value\": 186,\n",
       "                    \"name\": \"\\u672a\\u77e5\"\n",
       "                }\n",
       "            ],\n",
       "            \"center\": [\n",
       "                \"75%\",\n",
       "                \"50%\"\n",
       "            ],\n",
       "            \"type\": \"pie\",\n",
       "            \"seriesId\": 2161846,\n",
       "            \"name\": \"B\",\n",
       "            \"roseType\": \"area\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": \"{b}: {d}%\",\n",
       "                    \"position\": \"outside\",\n",
       "                    \"show\": true\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": \"{b}: {d}%\",\n",
       "                    \"show\": true\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"top\": \"center\",\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"feature\": {\n",
       "            \"restore\": {\n",
       "                \"title\": \"restore\",\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"title\": \"data view\",\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"saveAsImage\": {\n",
       "                \"title\": \"save as image\",\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"top\": \"auto\",\n",
       "            \"text\": \"\\u533f\\u540d\\u60c5\\u51b5\\u548c\\u6027\\u522b\\u5360\\u6bd4\",\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"left\": \"center\"\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"data\": [\n",
       "                \"\\u533f\\u540d\\u7528\\u6237\",\n",
       "                \"\\u6b63\\u5e38\\u7528\\u6237\",\n",
       "                \"\\u7537\",\n",
       "                \"\\u5973\",\n",
       "                \"\\u672a\\u77e5\"\n",
       "            ],\n",
       "            \"left\": \"center\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": false\n",
       "        }\n",
       "    ],\n",
       "    \"series_id\": 2161846,\n",
       "    \"tooltip\": {\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"trigger\": \"item\",\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        }\n",
       "    }\n",
       "};\n",
       "myChart_c80b2d639a374428b78650558a98dd0a.setOption(option_c80b2d639a374428b78650558a98dd0a);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.pie.Pie at 0x7df6588>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Pie\n",
    "\n",
    "values1 = [len(df.loc[df['用户名'] == '匿名用户',])/len(df),1 - len(df.loc[df['用户名'] == '匿名用户',])/len(df)]\n",
    "labels1 = ['匿名用户','正常用户']\n",
    "\n",
    "\n",
    "values2 = [len(df.loc[df['用户名'] != '匿名用户',:].loc[df.loc[df['用户名'] != '匿名用户',:]['sex'] == '男',]),\n",
    "           len(df.loc[df['sex'] == '女',]),len(df.loc[df['sex'] == '未知',])]\n",
    "labels2 = ['男','女','未知']\n",
    "\n",
    "\n",
    "pie = Pie('匿名情况和性别占比',title_pos = 'center',width = 1000)\n",
    "\n",
    "pie.add('A',labels1,values1,center = [30,50],rosetype = 'radius',\n",
    "        radius = [30,60],is_legend_show = False,is_label_show = True)\n",
    "\n",
    "pie.add('B',labels2,values2,center = [75,50],rosetype = 'area',\n",
    "        radius = [30,60],is_legend_show = False,is_label_show = True,\n",
    "        is_random = True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 将时间戳转换为易读的时间格式\n",
    "## 并绘制回答创建时间分布图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"da3b6a8506e54ac59011aa2ca2f9ef44\" style=\"width:1000px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_da3b6a8506e54ac59011aa2ca2f9ef44 = echarts.init(document.getElementById('da3b6a8506e54ac59011aa2ca2f9ef44'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_da3b6a8506e54ac59011aa2ca2f9ef44 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"markPoint\": {\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"symbolSize\": 50,\n",
       "                        \"symbol\": \"pin\",\n",
       "                        \"type\": \"max\",\n",
       "                        \"label\": {\n",
       "                            \"normal\": {\n",
       "                                \"textStyle\": {\n",
       "                                    \"color\": \"#fff\"\n",
       "                                }\n",
       "                            }\n",
       "                        },\n",
       "                        \"name\": \"Maximum\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"data\": [\n",
       "                15.0,\n",
       "                68.0,\n",
       "                59.0,\n",
       "                19.0,\n",
       "                10.0,\n",
       "                10.0,\n",
       "                19.0,\n",
       "                3.0,\n",
       "                15.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                2.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                221.0,\n",
       "                41.0,\n",
       "                3.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0,\n",
       "                1.0\n",
       "            ],\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"type\": \"bar\",\n",
       "            \"seriesId\": 7284555,\n",
       "            \"name\": \"A\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"position\": \"top\",\n",
       "                    \"show\": false\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"top\": \"center\",\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"feature\": {\n",
       "            \"restore\": {\n",
       "                \"title\": \"restore\",\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"title\": \"data view\",\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"saveAsImage\": {\n",
       "                \"title\": \"save as image\",\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"top\": \"auto\",\n",
       "            \"text\": \"\\u56de\\u7b54\\u521b\\u5efa\\u65f6\\u95f4\\u5206\\u5e03\",\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"left\": \"center\"\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"boundaryGap\": true,\n",
       "            \"inverse\": false,\n",
       "            \"nameGap\": 25,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"2018-02-07\",\n",
       "                \"2018-02-08\",\n",
       "                \"2018-02-09\",\n",
       "                \"2018-02-10\",\n",
       "                \"2018-02-11\",\n",
       "                \"2018-02-12\",\n",
       "                \"2018-02-13\",\n",
       "                \"2018-02-14\",\n",
       "                \"2018-02-15\",\n",
       "                \"2018-02-16\",\n",
       "                \"2018-02-17\",\n",
       "                \"2018-02-18\",\n",
       "                \"2018-02-19\",\n",
       "                \"2018-02-20\",\n",
       "                \"2018-02-22\",\n",
       "                \"2018-02-27\",\n",
       "                \"2018-03-06\",\n",
       "                \"2018-03-11\",\n",
       "                \"2018-06-04\",\n",
       "                \"2018-06-23\",\n",
       "                \"2019-01-20\",\n",
       "                \"2019-01-21\",\n",
       "                \"2019-01-29\",\n",
       "                \"2019-02-02\",\n",
       "                \"2019-02-09\",\n",
       "                \"2019-02-10\",\n",
       "                \"2019-02-11\",\n",
       "                \"2019-02-12\",\n",
       "                \"2019-02-19\",\n",
       "                \"2019-02-20\",\n",
       "                \"2019-03-10\",\n",
       "                \"2019-06-12\",\n",
       "                \"2019-09-05\"\n",
       "            ],\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"show\": true,\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 12\n",
       "                },\n",
       "                \"margin\": 8,\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0\n",
       "            },\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"data\": [\n",
       "                \"A\"\n",
       "            ],\n",
       "            \"left\": \"center\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": false\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"boundaryGap\": true,\n",
       "            \"show\": true,\n",
       "            \"inverse\": false,\n",
       "            \"nameGap\": 25,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"type\": \"value\",\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 12\n",
       "                },\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"margin\": 8,\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"series_id\": 7284555,\n",
       "    \"tooltip\": {\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"trigger\": \"item\",\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        }\n",
       "    }\n",
       "};\n",
       "myChart_da3b6a8506e54ac59011aa2ca2f9ef44.setOption(option_da3b6a8506e54ac59011aa2ca2f9ef44);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x46ddcc0>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import datetime\n",
    "\n",
    "def convert_time(x):\n",
    "    return datetime.datetime.fromtimestamp(x).strftime('%Y-%m-%d')\n",
    "\n",
    "#把更新时间，创建时间都转化成我们习惯的时间格式\n",
    "df['更新时间'] = pd.to_datetime(df['更新时间'].apply(convert_time))\n",
    "df['创建时间'] =pd.to_datetime(df['创建时间'].apply(convert_time))\n",
    "\n",
    "from pyecharts import Bar\n",
    "\n",
    "x = df.groupby('创建时间').count().index\n",
    "y = df.groupby('创建时间').count()['用户名']\n",
    "\n",
    "bar = Bar('回答创建时间分布',title_pos = 'center',width = 1000)\n",
    "bar.add('A',x,y,is_legend_show = False,mark_point = ['max'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 由于匿名用户都不显示真实的行业，所以先剔除之"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>token</th>\n",
       "      <th>内容</th>\n",
       "      <th>创建时间</th>\n",
       "      <th>性别</th>\n",
       "      <th>是否可以评论</th>\n",
       "      <th>更新时间</th>\n",
       "      <th>点赞数</th>\n",
       "      <th>用户ID</th>\n",
       "      <th>用户名</th>\n",
       "      <th>用户类型</th>\n",
       "      <th>签名</th>\n",
       "      <th>被关注人数</th>\n",
       "      <th>评论数</th>\n",
       "      <th>问题</th>\n",
       "      <th>专业</th>\n",
       "      <th>教育经历</th>\n",
       "      <th>行业</th>\n",
       "      <th>sex</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>sun-wu-jing-91-57</td>\n",
       "      <td>不该。&lt;br/&gt;千万别说。&lt;br/&gt;&lt;br/&gt;以我为例，&lt;br/&gt;&lt;br/&gt;我实在是没法跟亲...</td>\n",
       "      <td>2018-02-08</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>2018-02-08</td>\n",
       "      <td>1342</td>\n",
       "      <td>ce8245b32b745f18ef58ca042a3a8651</td>\n",
       "      <td>孙悟净</td>\n",
       "      <td>people</td>\n",
       "      <td>她说要把它们都打败\\n我说我会一直都在</td>\n",
       "      <td>37173</td>\n",
       "      <td>200</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>第二小学</td>\n",
       "      <td>['黑色金属', '一无所有', '背负着空虚倔强']</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>wo-ai-luo-4-14</td>\n",
       "      <td>&lt;figure&gt;&lt;noscript&gt;&lt;img src=\"https://pic2.zhimg...</td>\n",
       "      <td>2018-02-08</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>2018-02-08</td>\n",
       "      <td>513</td>\n",
       "      <td>bef6149719717434b53d897031c5da20</td>\n",
       "      <td>林杰</td>\n",
       "      <td>people</td>\n",
       "      <td>鸡飞的男人</td>\n",
       "      <td>8</td>\n",
       "      <td>65</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>['创意艺术']</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               token                                                 内容  \\\n",
       "0  sun-wu-jing-91-57  不该。<br/>千万别说。<br/><br/>以我为例，<br/><br/>我实在是没法跟亲...   \n",
       "1     wo-ai-luo-4-14  <figure><noscript><img src=\"https://pic2.zhimg...   \n",
       "\n",
       "        创建时间  性别  是否可以评论       更新时间   点赞数                              用户ID  \\\n",
       "0 2018-02-08   1    True 2018-02-08  1342  ce8245b32b745f18ef58ca042a3a8651   \n",
       "1 2018-02-08   1    True 2018-02-08   513  bef6149719717434b53d897031c5da20   \n",
       "\n",
       "   用户名    用户类型                   签名  被关注人数  评论数                      问题   专业  \\\n",
       "0  孙悟净  people  她说要把它们都打败\\n我说我会一直都在  37173  200  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "1   林杰  people                鸡飞的男人      8   65  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "\n",
       "   教育经历                           行业 sex  \n",
       "0  第二小学  ['黑色金属', '一无所有', '背负着空虚倔强']   男  \n",
       "1   NaN                     ['创意艺术']   男  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filter_result = df.loc[df['用户名'] != '匿名用户',:]\n",
    "filter_result.head(2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 粗暴的提取行业相关信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\python\\lib\\site-packages\\ipykernel_launcher.py:13: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  del sys.path[0]\n",
      "D:\\python\\lib\\site-packages\\ipykernel_launcher.py:14: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  \n"
     ]
    }
   ],
   "source": [
    "def return_hangye(x):\n",
    "    if len(x) == 0:\n",
    "        return '未知'\n",
    "    else:\n",
    "        return x[0][1:-1]\n",
    "    \n",
    "def return_pos(x):\n",
    "    if len(x) <=1:\n",
    "        return '未知'\n",
    "    else:\n",
    "        return x[-1][2:-1]\n",
    "\n",
    "filter_result['所处行业'] = filter_result['行业'].astype(str).str[1:-1].replace(\"'\",\"\").str.split(',').apply(return_hangye)\n",
    "filter_result['岗位'] = filter_result['行业'].astype(str).str[1:-1].replace(\"'\",\"\").str.split(',').apply(return_pos)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>token</th>\n",
       "      <th>内容</th>\n",
       "      <th>创建时间</th>\n",
       "      <th>性别</th>\n",
       "      <th>是否可以评论</th>\n",
       "      <th>更新时间</th>\n",
       "      <th>点赞数</th>\n",
       "      <th>用户ID</th>\n",
       "      <th>用户名</th>\n",
       "      <th>用户类型</th>\n",
       "      <th>签名</th>\n",
       "      <th>被关注人数</th>\n",
       "      <th>评论数</th>\n",
       "      <th>问题</th>\n",
       "      <th>专业</th>\n",
       "      <th>教育经历</th>\n",
       "      <th>行业</th>\n",
       "      <th>sex</th>\n",
       "      <th>所处行业</th>\n",
       "      <th>岗位</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>sun-wu-jing-91-57</td>\n",
       "      <td>不该。&lt;br/&gt;千万别说。&lt;br/&gt;&lt;br/&gt;以我为例，&lt;br/&gt;&lt;br/&gt;我实在是没法跟亲...</td>\n",
       "      <td>2018-02-08</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "      <td>2018-02-08</td>\n",
       "      <td>1342</td>\n",
       "      <td>ce8245b32b745f18ef58ca042a3a8651</td>\n",
       "      <td>孙悟净</td>\n",
       "      <td>people</td>\n",
       "      <td>她说要把它们都打败\\n我说我会一直都在</td>\n",
       "      <td>37173</td>\n",
       "      <td>200</td>\n",
       "      <td>过年回家，亲戚问是做什么工作的，该说实话吗？</td>\n",
       "      <td>NaN</td>\n",
       "      <td>第二小学</td>\n",
       "      <td>['黑色金属', '一无所有', '背负着空虚倔强']</td>\n",
       "      <td>男</td>\n",
       "      <td>黑色金属</td>\n",
       "      <td>背负着空虚倔强</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               token                                                 内容  \\\n",
       "0  sun-wu-jing-91-57  不该。<br/>千万别说。<br/><br/>以我为例，<br/><br/>我实在是没法跟亲...   \n",
       "\n",
       "        创建时间  性别  是否可以评论       更新时间   点赞数                              用户ID  \\\n",
       "0 2018-02-08   1    True 2018-02-08  1342  ce8245b32b745f18ef58ca042a3a8651   \n",
       "\n",
       "   用户名    用户类型                   签名  被关注人数  评论数                      问题   专业  \\\n",
       "0  孙悟净  people  她说要把它们都打败\\n我说我会一直都在  37173  200  过年回家，亲戚问是做什么工作的，该说实话吗？  NaN   \n",
       "\n",
       "   教育经历                           行业 sex  所处行业       岗位  \n",
       "0  第二小学  ['黑色金属', '一无所有', '背负着空虚倔强']   男  黑色金属  背负着空虚倔强  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filter_result.head(1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 可视化行业"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"ca50048a688f4f2483cbd333796ed8f9\" style=\"width:1000px;height:400px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_ca50048a688f4f2483cbd333796ed8f9 = echarts.init(document.getElementById('ca50048a688f4f2483cbd333796ed8f9'), 'light', {renderer: 'canvas'});\n",
       "\n",
       "var option_ca50048a688f4f2483cbd333796ed8f9 = {\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ],\n",
       "    \"animation\": true,\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"markPoint\": {\n",
       "                \"data\": [\n",
       "                    {\n",
       "                        \"symbolSize\": 50,\n",
       "                        \"symbol\": \"pin\",\n",
       "                        \"type\": \"max\",\n",
       "                        \"label\": {\n",
       "                            \"normal\": {\n",
       "                                \"textStyle\": {\n",
       "                                    \"color\": \"#fff\"\n",
       "                                }\n",
       "                            }\n",
       "                        },\n",
       "                        \"name\": \"Maximum\"\n",
       "                    }\n",
       "                ]\n",
       "            },\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"data\": [\n",
       "                0.46,\n",
       "                0.13,\n",
       "                0.07,\n",
       "                0.07,\n",
       "                0.06,\n",
       "                0.05,\n",
       "                0.04,\n",
       "                0.04,\n",
       "                0.04,\n",
       "                0.04\n",
       "            ],\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"type\": \"bar\",\n",
       "            \"seriesId\": 3664869,\n",
       "            \"name\": \"A\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"position\": \"top\",\n",
       "                    \"show\": false\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"textStyle\": {\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"show\": true\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"top\": \"center\",\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"feature\": {\n",
       "            \"restore\": {\n",
       "                \"title\": \"restore\",\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"title\": \"data view\",\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"saveAsImage\": {\n",
       "                \"title\": \"save as image\",\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"top\": \"auto\",\n",
       "            \"text\": \"\\u5410\\u69fd\\u4eba\\u884c\\u4e1aTOP10\",\n",
       "            \"subtextStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"left\": \"center\"\n",
       "        }\n",
       "    ],\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"boundaryGap\": true,\n",
       "            \"inverse\": false,\n",
       "            \"nameGap\": 25,\n",
       "            \"type\": \"category\",\n",
       "            \"splitLine\": {\n",
       "                \"show\": false\n",
       "            },\n",
       "            \"data\": [\n",
       "                \"\\u4e92\\u8054\\u7f51\",\n",
       "                \"\\u8ba1\\u7b97\\u673a\\u8f6f\\u4ef6\",\n",
       "                \"\\u4e34\\u5e8a\\u533b\\u7597\",\n",
       "                \"\\u521b\\u610f\\u827a\\u672f\",\n",
       "                \"\\u9ad8\\u7b49\\u6559\\u80b2\",\n",
       "                \"\\u5e7f\\u544a\",\n",
       "                \"\\u7535\\u5b50\\u6e38\\u620f\",\n",
       "                \"\\u57fa\\u7840\\u6559\\u80b2\",\n",
       "                \"\\u751f\\u7269\\u5de5\\u7a0b\",\n",
       "                \"\\u7535\\u5b50\\u5546\\u52a1\"\n",
       "            ],\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"show\": true,\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 12\n",
       "                },\n",
       "                \"margin\": 8,\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0\n",
       "            },\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"data\": [\n",
       "                \"A\"\n",
       "            ],\n",
       "            \"left\": \"center\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12\n",
       "            },\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": false\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"boundaryGap\": true,\n",
       "            \"show\": true,\n",
       "            \"inverse\": false,\n",
       "            \"nameGap\": 25,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"type\": \"value\",\n",
       "            \"axisLine\": {\n",
       "                \"lineStyle\": {\n",
       "                    \"width\": 1\n",
       "                }\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 12\n",
       "                },\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"margin\": 8,\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"series_id\": 3664869,\n",
       "    \"tooltip\": {\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"trigger\": \"item\",\n",
       "        \"textStyle\": {\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"borderWidth\": 0,\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        }\n",
       "    }\n",
       "};\n",
       "myChart_ca50048a688f4f2483cbd333796ed8f9.setOption(option_ca50048a688f4f2483cbd333796ed8f9);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x4357400>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tc = filter_result['所处行业'].value_counts()[1:11].reset_index()\n",
    "tc['占比'] = tc['所处行业']/tc['所处行业'].sum()\n",
    "\n",
    "x = tc['index']\n",
    "y = tc['占比'].values\n",
    "\n",
    "bar = Bar('吐槽人行业TOP10',title_pos = 'center',width = 1000)\n",
    "bar.add('A',x,y,is_legend_show = False,mark_point = ['max'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 文章最后梗，不建议尝试运行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "count = 1\n",
    "ask = True\n",
    "\n",
    "while ask == True:\n",
    "    print('对象{}'.format(count))\n",
    "    count += 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
